package com.aegis.manage.service.sys.permission;


import com.aegis.common.mybatis.base.IBaseService;
import com.aegis.common.mybatis.model.PageResult;
import com.aegis.manage.api.dto.RolePermissionDTO;
import com.aegis.manage.api.request.AddPermissionRequest;
import com.aegis.manage.model.dos.SysPermission;

import java.util.List;
import java.util.Set;

/**
 * (SysPermission)表服务接口
 *
 * @author makejava
 * @since 2024-02-12 20:03:31
 */
public interface SysPermissionService extends IBaseService<SysPermission> {

    /**
     * 查询用户拥有哪些权限
     *
     * @param userId
     * @return
     */
    List<SysPermission> selectUserPermissionByUserId(String userId);


    /**
     * @return
     */
    List<SysPermission> selectAll();


    /**
     * 添加权限
     *
     * @param request
     */
    void addPermission(AddPermissionRequest request);

    /**
     * 查询权限分页
     *
     * @param current
     * @param size
     * @return
     */
    PageResult<SysPermission> selectPermissionPage(int current, int size);


    /**
     * 删除权限
     *
     * @param id
     */
    void delPermission(List<String> id);


    /**
     * 绑定角色权限
     *
     * @param roleId
     * @param permissionIds
     */
    void bindRolePermission(String roleId, Set<String> permissionIds);


    /**
     * 绑定菜单权限
     *
     * @param menuId
     * @param permissionIds
     */
    void bindMenuPermission(String menuId, Set<String> permissionIds);


    /**
     * 绑定菜单角色
     *
     * @param roleId
     * @param menuIds
     */
    void bindRoleMenu(String roleId, Set<String> menuIds);


    /**
     * 查询角色权限
     *
     * @param roleId
     * @return
     */
    List<RolePermissionDTO> selectRolePermissionByRoleId(String roleId);

}

